package com.recruit.wechat.controller;


import com.recruit.wechat.controller.model.ApiResultModel;
import org.springframework.web.bind.annotation.RequestMapping;
import com.recruit.wechat.bean.result.ResultPage;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ResponseBody;

import com.recruit.wechat.bean.WechatPersonal;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 肖守凯
 * @since 2020-08-24
 */
@Controller
@RequestMapping("/WeChatUser/wechatPersonal")
public class WechatPersonalController extends BaseController{
     /** 主页面 */
    @RequestMapping("admin/main.html")
    public String main(){
       return  "Wechatpersonal/WechatpersonalMain";
    }
    /** 添加页面跳转
     * @return 返回页面
     */
    @RequestMapping(value = "admin/addWechatPersonalHtml")
    public String addWechatPersonalHtml( ){
             return "Wechatpersonal/WechatpersonalAdd";
    }
    /** 编辑页面跳转
     * @param  id  前端传进的参数
     * @return 返回页面
     */
    @RequestMapping(value = "admin/editWechatPersonalHtml")
    public String editWechatPersonalHtml(Integer id ,Model model ){




           model.addAttribute("wechatPersonal",wechatPersonalService.selectWechatPersonalByIdWechatPersonal(id));
             return "Wechatpersonal/WechatpersonalEdit";
    }

    /** 查看页面跳转
     * @param  id  前端传进的参数
     * @return 返回页面
     */
    @RequestMapping(value = "admin/showWechatPersonalHtml")
    public String showWechatPersonalHtml(Integer id ,Model model ){
           model.addAttribute("wechatPersonal",wechatPersonalService.selectWechatPersonalByIdWechatPersonal(id));
             return "Wechatpersonal/WechatpersonalShow";
    }


    /** 分页查询WechatPersonal
     * @param page  页码
     * @param limit  查几条
     * @param wechatPersonal  前端传进的参数
     * @return 返回统一分页信息
     */
    @RequestMapping(value = "admin/findWechatPersonalByPage")
    @ResponseBody
    public ResultPage findWechatPersonalByPage(Integer page, Integer limit,WechatPersonal wechatPersonal){
             return wechatPersonalService.findWechatPersonalByPage(page,limit,wechatPersonal);
    }

    /** 添加WechatPersonal
     * @param wechatPersonal  前端传进的参数
     * @return 返回统一信息
     */
    @RequestMapping(value = "admin/addWechatPersonal")
    @ResponseBody
    public ApiResultModel saveWechatPersonal(WechatPersonal wechatPersonal  ){
             return wechatPersonalService.addWechatPersonal(wechatPersonal);
    }

    /** 编辑WechatPersonal
     * @param wechatPersonal  前端传进的参数
     * @return 返回统一信息
     */
    @RequestMapping(value = "admin/editWechatPersonal")
    @ResponseBody
    public ApiResultModel editWechatPersonal(WechatPersonal wechatPersonal  ){


        System.out.println("编辑wechatPersonal:"+wechatPersonal.toString());

             return wechatPersonalService.editWechatPersonal(wechatPersonal);
    }



    /** 删除一条WechatPersonal
     * @param id  前端传进的ID
     * @return 返回统一信息
     */
    @RequestMapping(value = "admin/delWechatPersonal")
    @ResponseBody
    public ApiResultModel delWechatPersonal( Integer id  ){
             return wechatPersonalService.delWechatPersonal(id);
    }


}
